<?php

$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'cruise',
    'basePath' => dirname(__DIR__),
    'language' => 'zh-CN',
    'bootstrap' => ['log'],
    'timezone' => 'Asia/Shanghai',
    'modules' => [
        'user' => [
            'class' => 'dektrium\user\Module',
            'enableUnconfirmedLogin' => false,
			'enableRegistration' => false, // 关闭注册
			'rememberFor' => 2400000,
            //'enableConfirmation' => false,
            'confirmWithin' => 86400,
            'cost' => 12,
            'admins' => ['admin']
        ],
		'rbac' => 'dektrium\rbac\RbacWebModule',
        'product' => ['class' => 'app\modules\Product\Bootstrap', ],
        'cruise'  => ['class' => 'app\modules\Cruise\Bootstrap', ],
        'front'   => ['class' => 'app\modules\Front\Bootstrap','layout'=>'//mui'],
        'member'  => ['class' => 'app\modules\Member\Bootstrap' ],
        'order'   => ['class' => 'app\modules\Order\Bootstrap', ],
		'finance' => ['class' => 'app\modules\Finance\Bootstrap',],
        'api' => ['class' => 'app\modules\api\Module',],
        'gridview' =>  ['class' => '\kartik\grid\Module'], 
        'redactor' => 'yii\redactor\RedactorModule',        // 编辑器
    ],
    'components' => [
        'request' => [
            'cookieValidationKey' => 'J7HSDeLbfU_8AdYDbRBiX83-Fvn1F-_L',
//			'class' => 'yii\web\Request',
//			'parsers' => [
//				'application/json' => 'yii\web\JsonParser',
//			],
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'qiniu' => ['class' => 'app\components\Qiniu',],
        'dates' => ['class' => 'app\components\Dates',],
        'ceils' => ['class' => 'app\components\Ceils',],
        'jssdk' => ['class' => 'app\components\JSSDK',],
        'orderblock' => ['class' => 'app\components\OrderBlock',],
        'weixin' => ['class' => 'app\components\WeiXin',],
        'gettoken' => ['class' => 'app\components\GetToken',],
        'authcode' => ['class' => 'app\components\Authcode',],
        'logs' => ['class' => 'app\components\Log',],
        'notice' => ['class' => 'app\components\Notice',],
        'token' => ['class' => 'app\components\Token',],
        //'user' => [
        //    'identityClass' => 'app\models\User',
        //    'enableAutoLogin' => true,
        //],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],

        'mailer' => [//{{{
            'class' => 'yii\swiftmailer\Mailer',
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.mxhichina.com',
                'username' => 'postmaster@lmeeting.com',
                'password' => 'Lmeeting1020',
                'port' => 25,
                'encryption' => 'tls',
            ],
            'messageConfig' => [
                'charset' => 'UTF-8',
                'from' => 'postmaster@lmeeting.com',
            ],
        ],//}}}



        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'i18n' => [
            'translations' => [
                //'app*' => [
                'app*' => [
                    'class' => 'yii\i18n\PhpMessageSource',   //使用php文件保存信息
                    'basePath' => '@app/messages',  //php文件保存位置
                    //'sourceLanguage' => 'en',
                    'fileMap' => [
                        'app' => 'app.php',
                        'app.supplier' => 'app.supplier.php',
                        'app.cruise' => 'app.cruise.php',
                        'app.order' => 'app.order.php',
                    ],
                ],
            ],
        ],

        'db' => require(__DIR__ . '/db.php'),
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,  //隐藏入口脚本
            'rules' => [
                'dashboard' => 'site/index',
                ['class' => 'yii\rest\UrlRule', 'controller' => ['api', 'content/applyrest','form/rest'] ],
            ],
        ],
        'session' => [
            'class' => 'yii\web\Session',
            'cookieParams' => ['lifetime' => 7 * 24 *60 * 60],
            'savePath' => dirname(__DIR__).'/session', //session存储位置
            'timeout' => 7 * 24 *60 * 60, //session过期时间
        ],
        
    ],
    'params' => $params,
    //'area' => $area,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
          'class' => 'yii\debug\Module',
          'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '*'],
    ];


    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
          'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '*'],
    ];
}

return $config;
